<?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;

/**
 * 背景墙管理
 *
 * Created on 2021/11/12 13:56
 * @Author <yuxiang.zhu@asiainnovations.net>
 */
class RoomBackgroundPictureManagementController extends BaseController
{
    /**
     * @param Request $request
     */
    public function __construct(Request $request)
    {
        parent::__construct($request);
    }

    /**
     * 获取列表
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function getList(Request $request)
    {
        $page = intval($request->input('page', 1));
        if ($page <= 0) {
            $page = 1;
        }

        $limit = intval($request->input('limit'));
        if ($limit <= 0) {
            $limit = 10;
        }

        return $this->parseApiResult(callKKAudioApi('inner/room_background_picture_management/get_list?page=' . $page . '&limit=' . $limit));
    }

    /**
     * 获取展示位置
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function getTypes()
    {
        return $this->parseApiResult(callKKAudioApi('inner/room_background_picture_management/get_types'));
    }

    /**
     * 增加
     *
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function add(Request $request)
    {
        return $this->parseApiResult(callKKAudioApi('inner/room_background_picture_management/add', $request->all()));
    }

    /**
     * 修改
     *
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function update(Request $request)
    {
        return $this->parseApiResult(callKKAudioApi('inner/room_background_picture_management/update', $request->all()));
    }

    /**
     * 删除
     *
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function delete(Request $request)
    {
        return $this->parseApiResult(callKKAudioApi('inner/room_background_picture_management/delete', $request->all()));
    }
}
